FROM golang:1.23.5 AS builder

WORKDIR /app

COPY . .

RUN go env -w GO111MODULE=on \
    && go env -w GOPROXY=https://goproxy.cn,direct \
    && go mod download \
    && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o game-server

FROM alpine:latest

WORKDIR /app

COPY --from=builder /app/game-server .
COPY --from=builder /app/config.yaml .
COPY --from=builder /app/static .

RUN mkdir -p /app/storage/logs

EXPOSE 8880

CMD ["./game-server"]